package com.flyee.utils
{
	import flash.display.*;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	public class CutCharacter
	{
		
		private var charBitmapArray:Array;
        //移动方向编号
        private var moveDirection:int;
        //存储图片的位置
        private var picStorageStation:int;
        //加载图片的宽度
        private var addPicWidth:int;
        //加载图片的宽度
        private var addPicHeight:int;
        //加载图片的行数
        private var addPicSNumber:uint;
        //加载图片的列数
        private var addPicHNumber:uint;
        
		public function CutCharacter()
		{
			
		}
				
		public static function cutTagSource(source:DisplayObject,tagFrame:uint,cutWidth:uint,cutHeight:uint):Array
		{
			var tempBitmapData:BitmapData = new BitmapData(source.width,source.height,true,0);
			tempBitmapData.draw(source);
			var charBitmapArray:Array = new Array();
			var rect:Rectangle = new Rectangle(0,0,cutWidth,cutHeight);
			var copyPoint:Point = new Point(0,0);
			for (var i:int =0; i< 8; i++){
				var directArray : Array = new Array();
				for (var j:int =0; j< tagFrame; j++){
					
					directArray[j] = new Bitmap(new BitmapData(cutWidth,cutHeight,true,0));
					rect.x = i * cutWidth;
					rect.y = j * cutHeight;
					directArray[j].bitmapData.copyPixels(tempBitmapData,rect,copyPoint);
	
				}
				charBitmapArray.push(directArray);
			}
			return charBitmapArray;
		}
		/**
		 *删除角色的动画 
		 * @param tagArray
		 * 
		 */		
		public static function removeCut(tagArray:Array):void
		{
			if(tagArray != null)
			{
				var tempLength:uint = tagArray.length
				for(var i:uint = 0;i < tempLength;i++)
				{
					if(tagArray[i] != null)
					{
						tagArray[i] = null;
					}
				}
			}
		}
	}
}